The present disclosure relates generally to memory management, and more particularly to methods and systems for releasing resources associated with objects stored in memory.
A computing system regularly uses memory management systems to manage the various memory hardware associated with the system. Memory management is the process of managing and coordinating computer memory. This includes assigning blocks of memory to various programs running on the computing system. The memory management system is designed to perform such tasks in a manner so as to optimize system performance.
The memory management system includes hardware, components of an operating system, and various applications. The hardware involved in memory management includes devices that physically store data. Such devices include (random access memory) RAM chips, memory caches, and SSDs (solid-state drives).
In the operating system, memory management involves the allocation, as well as reallocation, of specific memory blocks to individual programs. The allocation process is ongoing as the demands of different programs change. At the application level, memory management ensures the availability of adequate memory for the objects and data structures of each running program at all times. Application memory management may include tasks such as allocation and recycling.
Memory management systems seek to avoid an issue referred to as memory leakage. Memory leakage occurs when objects or data structures that are no longer being used are not made available for use by other objects. Specifically, the memory management system is not properly notified that the memory blocks occupied by the dead objects are available for reuse by other objects.
To address this issue, programmers may manually program memory deallocation functions into the applications or use destructors. Such functions will manually deallocate memory used by objects when those objects are no longer needed. Additionally, garbage collection functions, which may be part of the memory management system, may regularly search the memory pool for dead objects and free the memory associated with those dead objects.
But, sometimes those dead objects reference other resources, including remote resources. While such resources may be shutdown manually by the programmer, a programmer may forget to write the code in a manner to appropriately shutdown those resources. This can lead to a waste of resources and a less efficient computing system. Thus, it is desirable to have methods and systems for handling this issue.